/*
 * @Author: Aaron Huang
 * @Date: 2022-10-25 15:13:29
 * @LastEditors: Aaron Huang
 * @LastEditTime: 2022-11-03 11:33:06
 * @Description: file content
 * @FilePath: \ias_ui\src\components\searchHead\js\checkInput.js
 * @Company: 沃尔玛
 */
export const checkNumberList = {
  methods: {
    checkNumberList(v, item, itemLength = 10, quantity = 50) {
      let num = 0
      const data = v?.replace(/[^0-9\r?\n|(?<!\n)\r]/g, '') || ''
      const dataStr = data
        .split(/[\n\r]/)
        .filter((_) => {
          if (_) num++
          if (!_) return ' '
          else if (num <= quantity) return _
        })
        .map((_) => {
          if (_) return _.slice(0, itemLength)
          else return _
        })
        .join('\n')
      this.searchData[item.searchKey] = dataStr
    }
  }
}
